﻿using System.ComponentModel.Composition;
using Caliburn.Micro;

namespace SimpleViewComposition.ViewModels
{
    [Export]
    public class ConductorViewModel : Conductor<IScreen>.Collection.AllActive
    {
        private BottomViewModel _bottom;
        private TopViewModel _top;

        [ImportingConstructor]
        public ConductorViewModel(TopViewModel top, BottomViewModel bottom)
        {
            _top = top;
            _bottom = bottom;
        }

        public TopViewModel Top
        {
            get { return _top; }
            set
            {
                _top = value;
                NotifyOfPropertyChange(() => Top);
            }
        }

        public BottomViewModel Bottom
        {
            get { return _bottom; }
            set
            {
                _bottom = value;
                NotifyOfPropertyChange(() => Bottom);
            }
        }

        protected override void OnInitialize()
        {
            base.OnInitialize();
            ActivateItem(Top);
            ActivateItem(Bottom);
        }
    }
}